/*******************************************************************************************
*
*   raylib-extras [ImGui] example - Simple Integration
*
*	This is a simple ImGui Integration
*	It is done using C++ but with C style code
*	It can be done in C as well if you use the C ImGui wrapper
*	https://github.com/cimgui/cimgui
*
*   Copyright (c) 2021 Jeffery Myers
*
********************************************************************************************/

//write from this(up)

#include <emscripten.h>
#include <emscripten/emscripten.h>
#include "level1.h"
#include "raylib.h"
#include "raymath.h"
#include "alllevel.h"

#include "imgui.h"
#include "rlImGui.h"

int count = 0;

void (*funcarr[32])() = {nullptr};

void RayImGuiDemo(){
		BeginDrawing();
		ClearBackground(DARKGRAY);

		// start ImGui Conent
		rlImGuiBegin();

		// show ImGui Content
		bool open = true;
		ImGui::ShowDemoWindow(&open);

		// end ImGui Content
		rlImGuiEnd();

		EndDrawing();
}

void InitGame();
void UpdateGame();

int main(int argc, char* argv[])
{
	int screenWidth = 800;
	int screenHeight = 600;
	SetConfigFlags(FLAG_MSAA_4X_HINT | FLAG_VSYNC_HINT | FLAG_WINDOW_RESIZABLE);
	SetWindowIcon(LoadImage("resource/icon.png"));
	InitWindow(screenWidth, screenHeight, "Game");
	InitGame();
	rlImGuiSetup(true);
	emscripten_set_main_loop(UpdateGame, 30, 1);
	rlImGuiShutdown();
	CloseWindow();
	return 0;
}

void InitGame(){
	funcarr[0] = RayImGuiDemo;
	funcarr[1] = UpdateLevel1;
	count = 1;
}

void UpdateGame(){
	funcarr[count]();
}

